package com.skyolder.crutch.ev;

import java.util.HashMap;

public class Environment {
	Environment parent=null;
	HashMap<String, Object> vars=new HashMap<String,Object>();
	public Environment(Environment parent){
		this.parent=parent;
	}
	public void putVar(String key ,Object r){
		vars.put(key, r);
	}
	public Object getVar(String key){
		return vars.get(key);
	}
	public Object findVar(String key){
		Object o=vars.get(key);
		if(o!=null){
			return o;
		}
		if(parent==null){
			return null;
		}
		return parent.getVar(key);
	}
}
